<template>
    <view>
        <form>
          <xmInfo
      :projectno="dataInfo.oldid"
      :projectname="dataInfo.projInfo.projectname"
    ></xmInfo>
    <!-- v-if="status != vuex_config.zgStatus" -->
          <!-- <view class="cu-form-group">
            <view style=" display: inline-block;padding: 5px;background:#8dc63f;color: #fff;text-align: center;font-style: italic;font-weight: bold"> 申请信息 </view>
          </view> -->
          <view class="cu-card" style="margin-top: 10px;">
            <!-- <view class="cu-form-group ">
                <view class="title"><text class="cuIcon-kb text-xs text-red"></text>施工单位</view>
                <view>{{ dataInfo.constructionunit }}</view>
            </view> -->
            <!-- <view class="cu-form-group">
                <view class="title"><text class="cuIcon-kb text-xs text-red"></text>原工程编码</view>
                <view><input disabled placeholder="请输入原工程编码" name="input" v-model="dataInfo.oldid"  class="input-align"></input></view>
            </view> -->
            <view class="cu-form-group ">
                <view class="title"><text class="cuIcon-kb text-xs text-red"></text>裁断名称</view>
                <view><input disabled placeholder="请输入裁断名称" name="input" v-model="dataInfo.name"  class="input-align"></input></view>
            </view>
         <!--   <view class="cu-form-group ">
                <view class="title"><text class="cuIcon-kb text-xs text-red"></text>裁断原因</view>
                <view><input disabled placeholder="请输入裁断原因" name="input" v-model="dataInfo.remarks"  class="input-align"></input></view>
            </view>
			 -->
			<!-- <view class="cu-bar bg-white">
			    <view class="action">裁断原因</view>
			</view> -->
			<view class="cu-form-group" style="min-height: 0;"></view>
			<view class="cu-bar bg-white">
			    <view class="action"><text class="cuIcon-kb text-xs text-red"></text>裁断原因</view>
			</view>
			<view class="cu-form-group">
			  <textarea
			  disabled
			    maxlength="-1"
			    v-model="dataInfo.reasondetail"
			    placeholder="请输入裁断原因"
			  ></textarea>
			</view>
            <view class="cu-form-group" style="min-height: 0;"></view>
            <view class="cu-bar bg-white">
                <view class="action"><text class="cuIcon-kb text-xs text-red"></text>裁断附件</view>
            </view>
            <view class="cu-bar bg-white ">
                <js-uploadfile v-model="dataInfo.dataMap" :biz-key="dataInfo.id" biz-type="ProjectAdjudicationCut_file"             
                :deletable="false" 
                  customBtn="false"></js-uploadfile>
            </view>
			
			<view class="cu-form-group ">
			    <view class="title"><text class="cuIcon-kb text-xs text-red"></text>新项目编号</view>
			    <view><input disabled placeholder=" " name="input" v-model="dataInfo.newProjInfo.projectcode"  class="input-align"></input></view>
			</view>
          </view>
          <!-- <view class="cu-form-group">
            <view style=" display: inline-block;padding: 5px;background: #0081ff;color: #fff;text-align: center;font-style: italic;font-weight: bold">
              结果信息
              </view>
          </view> -->
          <!-- <view class="cu-card">
                <view class="cu-bar bg-white">
                    <view class="action"><text class="cuIcon-favorfill text-xs text-red"></text>检测报告评价</view>
                </view>
                <view class="cu-form-group">
                  <textarea
                    maxlength="-1"
                    v-model="dataInfo.assayassay"
                    @input="textareaAInput(dataInfo,$event)"
                    placeholder="请输入检测报告评价"
                  ></textarea>
                </view>


                <view class="cu-form-group">
                    <view class="title"><text class="cuIcon-favorfill text-xs text-red"></text>检测结果</view>
                    <js-radio v-model="dataInfo.assayresult" dict-type="zf_assay_result"></js-radio>
                </view>
                
                
                <view class="cu-form-group" style="min-height: 0;"></view>

                <view class="cu-bar bg-white">
                    <view class="action"><text class="cuIcon-kb text-xs text-red"></text>检测结果附件</view>
                </view>
                <view class="cu-bar bg-white ">
                    <js-uploadfile v-model="dataInfo.dataMap" :biz-key="dataInfo.id" biz-type="PmWaterAnalysis_rs_file"             
                     ></js-uploadfile>
                </view>
          </view> -->

        </form>
        <view style="height: 80px"></view>
          <view class="btn-group cu-bar foot cu-bar1">
              <view class="flex">
                <js-bpm-button
                  v-model="dataInfo.bpm"
                  :biz-key="dataInfo.id"
                  form-key="Flow_ProjectAdjudicationCut"
                  @complete="submit"
                ></js-bpm-button>
            </view>
        </view>
    </view>
</template>
<script>
import xmInfo from "@/pages/zfgs/index/componetns/xmInfo.vue";
import { hasPermission } from "@/common/fire.js";
export default {
  components: { xmInfo },
  data() {
    return {
      startTime: false, //控制日期显示
      switchA: false,
      modalName: null,
      uploadOptions: {},
      modalNameDetail: null,
      showAddDetail: false,
      dataInfo: {},
      showButton: true,
      flag: hasPermission("proj:zg:pmRectification:edit"),
      status: "",
      projectno: "",
      projectname: "",
    };
  },
  onLoad(params) {
    console.log(params, "params===");
    let obj = {};
    if (params.id) {
      obj = params;
    } else {
      let item = JSON.parse(params.item);
      obj = {
        projectno: item.projectno,
        name: item.projectname,
      };
      this.projectno = item.projectno;
      this.projectname = item.projectname;
    }
    this.status = params.status;

    this.$u.api.zfgs.pmProjectadjudicationcutForm(obj).then((res) => {
      this.dataInfo = res.pmProjectadjudicationcut;
      console.log(this.dataInfo);
    });
  },
  methods: {
    textareaAInput(item, e) {
      if (item.assayassay == undefined) {
        this.$set(item, "checkopinion", e.detail.value);
      } else {
        this.$set(item, "assayassay", e.detail.value);
      }
    },

    submit() {
      // if (!this.dataInfo.assayassay) {
      //   this.$u.toast("检测报告评价必填");
      //   return;
      // }
      // if (!this.dataInfo.assayresult) {
      //   this.$u.toast("检测结果必选");
      //   return;
      // }
        try {
          // 去除this.dataInfo.status 属性
          this.$u.api.zfgs.pmProjectadjudicationcutSave(this.dataInfo).then((res) => {
            if (res.result == "true") {
              this.$u.toast(res.message);
              setTimeout(() => {
                uni.navigateBack({
                  delta: 1,
                });
              }, 500);
            } else {
              uni.showModal({
                title: "提示",
                content: res.message,
                showCancel: false,
                success: (res) => {},
              });
            }
          });
        } catch (error) {
          this.$u.toast(error.message);
        } finally {
        }
    },
  },
};
</script>
<style lang="scss" scoped>
.pre {
  // 空格或者换行符换行
  white-space: pre-wrap;
}
/deep/.u-input__input.data-v-460c1d26 {
  text-align: right !important;
}
.action {
  color: #303133;
}
.title {
  flex-shrink: 0;
}
.text-sl {
  font-size: 22px !important;
}
.cu-bar1 {
  min-height: 80px;
}
.cu-btn {
  font-size: 16px;
  height: 40px;
}
.foot {
  z-index: 997;
  background: #fff;
}
.green {
  color: green;
}
.input-align {
  text-align: right;
}
::v-deep .u-input__input {
  text-align: right;
}
.text-xs {
  font-size: 18rpx !important;
}
.cuIcon-kb::before {
      // content 为空白
      display: inline-block;
      content: ' ';
      width: 18rpx;
      height: 100%;
      
  }
</style>